<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>会员积分管理系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
    /* 基础样式重置 */
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body {
        font-family: 'Segoe UI', system-ui, sans-serif;
        line-height: 1.6;
        color: #334155;
        background: #f8fafc;
        font-size: 16px;
    }

    /* 主容器 */
    .module-section {
        max-width: 1280px;
        margin: 0 auto;
        padding: 2rem 1.5rem;
    }

    /* 卡片通用样式 */
    .card {
        background: white;
        border-radius: 1rem;
        padding: 2rem;
        margin-bottom: 2rem;
        box-shadow: 0 1px 20px rgba(0, 0, 0, 0.05);
        border: 1px solid #e2e8f0;
    }

    /* 模块标题 */
    .module-title {
        font-size: 1.5rem;
        color: #1e293b;
        margin-bottom: 2rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    .module-title i {
        font-size: 1.2em;
        color: #3b82f6;
    }

    /* 统计卡片 */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .stat-card {
        background: white;
        padding: 1.5rem;
        border-radius: 1rem;
        display: flex;
        align-items: center;
        gap: 1.5rem;
        transition: transform 0.2s;
        border: 1px solid #e2e8f0;
    }

    .stat-card:hover {
        transform: translateY(-2px);
    }

    .stat-icon {
        width: 60px;
        height: 60px;
        border-radius: 14px;
        display: grid;
        place-items: center;
        background: #eff6ff;
        color: #3b82f6;
        font-size: 1.5rem;
    }

    .stat-content span:first-child {
        font-size: 1.75rem;
        font-weight: 700;
        color: #1e293b;
        display: block;
        line-height: 1.3;
    }
    .stat-content span:last-child {
        color: #64748b;
        font-size: 1rem;
    }

    /* 表单样式 */
    .multi-column-form {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem 2rem;
    }

    .form-group {
        margin-bottom: 0.5rem;
    }

    .form-group label {
        display: block;
        margin-bottom: 0.75rem;
        font-weight: 500;
        color: #475569;
        font-size: 1rem;
    }

    input, select, textarea {
        width: 100%;
        padding: 0.75rem 1rem;
        border: 2px solid #e2e8f0;
        border-radius: 0.75rem;
        font-size: 1rem;
        transition: border-color 0.2s;
    }

    input:focus, select:focus, textarea:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    textarea {
        resize: vertical;
        min-height: 100px;
    }

    /* 日期输入组 */
    .date-input-group {
        display: grid;
        grid-template-columns: 1fr 24px 1fr;
        align-items: center;
        gap: 0.75rem;
    }
    .date-separator {
        color: #94a3b8;
        font-size: 0.9rem;
    }

    /* 按钮样式 */
    .submit-btn {
        padding: 0.75rem 1.5rem;
        border: none;
        border-radius: 0.75rem;
        font-size: 1rem;
        font-weight: 500;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        transition: all 0.2s;
    }

    .submit-btn i {
        font-size: 1.1em;
    }

    .submit-btn:hover {
        opacity: 0.9;
        transform: translateY(-1px);
    }

    .export-btn {
        background: #10b981;
        color: white;
    }

    /* 数据表格 */
    .data-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 1.5rem;
        font-size: 1rem;
    }

    .data-table th,
    .data-table td {
        padding: 1rem;
        text-align: left;
        border-bottom: 1px solid #e2e8f0;
    }

    .data-table th {
        background: #f8fafc;
        color: #475569;
        font-weight: 600;
    }

    .data-table tr:hover {
        background: #f8fafc;
    }

    /* 徽章样式 */
    .badge {
        padding: 0.35rem 0.75rem;
        border-radius: 0.5rem;
        font-size: 0.9rem;
        font-weight: 500;
    }
    .badge-success {
        background: #dcfce7;
        color: #22c55e;
    }
    .badge-warning {
        background: #fef9c3;
        color: #eab308;
    }

    /* 响应式设计 */
    @media (max-width: 768px) {
        .module-section {
            padding: 1.5rem 1rem;
        }

        .card {
            padding: 1.5rem;
        }

        .multi-column-form {
            grid-template-columns: 1fr;
        }

        .stats-grid {
            grid-template-columns: 1fr;
        }

        .data-table {
            display: block;
            overflow-x: auto;
        }
    }
    </style>
</head>
<body>
        <!-- 积分兑换商品卡片 -->
        <div class="card">
            <h2 class="module-title">
                <i class="fas fa-gift"></i>
                积分兑换商品
                <button type="button" id="add-redeem-product-btn" class="submit-btn" style="background: #3b82f6; color: white; margin-left: auto;">
                    <i class="fas fa-plus-circle"></i>
                    从库存添加商品
                </button>
            </h2>
            <form class="multi-column-form" id="redeem-form">
                <div class="form-group">
                    <label>会员信息</label>
                    <input type="text" id="member-search" placeholder="手机号" autocomplete="off">
                    <div id="member-info" style="margin-top: 0.5rem; color: #3b82f6;"></div>
                </div>
                <div class="form-group">
                    <label>兑换商品</label>
                    <select id="product-select">
                        <option value="">请选择商品</option>
                        <!-- 动态填充商品选项 -->
                    </select>
                </div>
                <div class="form-group">
                    <label>兑换数量</label>
                    <input type="number" id="redeem-qty" min="1" value="1">
                </div>
                <div class="form-group">
                    <label>当前积分</label>
                    <input type="text" id="current-points" readonly>
                </div>
                <div class="form-group">
                    <label>所需积分</label>
                    <input type="text" id="required-points" readonly>
                </div>
                <div class="form-group">
                    <label>兑换后剩余积分</label>
                    <input type="text" id="after-points" readonly>
                </div>
                <div class="form-group" style="align-self: end">
                    <button type="submit" class="submit-btn" style="background: #3b82f6; color: white">
                        <i class="fas fa-gift"></i>
                        立即兑换
                    </button>
                </div>
            </form>
        </div>
        <!-- 积分明细表格 -->
        <div class="card">
            <h2 class="module-title">
                <i class="fas fa-list-ul"></i>
                积分明细
            </h2>
            
            <table class="data-table">
                <thead>
                    <tr>
                        <th>时间</th>
                        <th>会员信息</th>
                        <th>花费积分</th>
                        <th>剩余积分</th>
                    </tr>
                </thead>
                <tbody>
                    <!-- 会员未登录时不显示任何记录 -->
                </tbody>
            </table>
        </div>
    </div>
    <!-- 兑换商品选择模态框 -->
    <div id="redeem-modal" class="modal" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); justify-content:center; align-items:center;">
        <div class="card" style="width:800px; max-height:80%; overflow:auto;">
            <h2 class="module-title"><i class="fas fa-list"></i> 选择库存商品</h2>
            <div id="redeem-modal-list" style="padding:1rem;"></div>
            <div class="form-group" style="display:flex; justify-content:flex-end; gap:1rem; margin-top:1.5rem; padding:0 1rem 1rem;">
                <button type="button" id="redeem-modal-cancel" class="submit-btn" style="background: #94a3b8; color: white; padding: 0.75rem 1.5rem;">
                    <i class="fas fa-times"></i> 取消
                </button>
                <button type="button" id="redeem-modal-confirm" class="submit-btn" style="background: #3b82f6; color: white; padding: 0.75rem 1.5rem;">
                    <i class="fas fa-check"></i> 确认
                </button>
            </div>
        </div>
    </div>
</body>
</html>